<?php
/**
 * 新闻表
 */
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateArticleTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('article', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('class_id')->default(0)->comment('新闻分类ID');
            $table->integer('file_id')->comment('图片ID');
            $table->string('title')->comment('新闻标题');
            $table->longText('content')->comment('新闻内容');
            $table->tinyInteger('status')->default(1)->comment('是否显示 1是 2否');
            $table->integer('sort')->comment('排序');
            $table->timestamps();
            $table->softDeletes();
        });
        //添加表注释
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `".config('database.connections.mysql.prefix')."article` comment'新闻表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('article');
    }
}
